package plochki;

//Collision Cell based algorithm
//Same as BaiGrozdan, but Collisions are traversed in reversed order
public class BaiPetkan extends BaiGrozdan {

	public BaiPetkan(String inputFile) {
		super(inputFile);
		
		this.name = "BaiPetkan";
	}
	
	public BaiPetkan(String[] inputFigures) {
		super(inputFigures);
		
		this.name = "BaiPetkan";
	}

	//For each Collision, find new places for the Figures in the Collision, starting from the easiest to move
	protected void resolveCollisions() {
		CollisionCell cCell;
		
		for (int i = this.collisionCells.size() - 1; i >= 0; i--) {
			cCell = this.collisionCells.get(i);
			
			//Remove a Figure until a Collision is resolved
			this.resolveCollision(cCell);
		}
	}

}
